#include <stdio.h>
int evaluate_position(char board[8][8]) {
    int white = 0, blank = 0;
    for (int i = 0; i < 8; i++) {
        for (int j = 0; j < 8; j++) {
            switch (board[i][j])
            {
            case 'K':
                white += 10;
                break;
            case 'k':
                blank += 10;
                break;
            case 'Q':
                white += 9;
                break;
            case 'q':
                blank += 9;
                break;
            case 'R':
                white += 5;
                break;
            case 'r':
                blank += 5;
                break;
            case 'B':
                white += 3;
                break;
            case 'b':
                blank += 3;
                break;
            case 'N':
                white += 3;
                break;
            case 'n':
                blank += 3;
                break;
            case 'P':
                white += 1;
                break;
            case 'p':
                blank += 1;
                break;
            }
        }
    }
    return white - blank;
}
int evaluate_position2(char board[8][8]) {
    int white = 0, blank = 0;
    for (char *p = board[0]; p < board[0] + 8 * 8; p++) {
        switch (*p)
        {
        case 'K':
            white += 10;
            break;
        case 'k':
            blank += 10;
            break;
        case 'Q':
            white += 9;
            break;
        case 'q':
            blank += 9;
            break;
        case 'R':
            white += 5;
            break;
        case 'r':
            blank += 5;
            break;
        case 'B':
            white += 3;
            break;
        case 'b':
            blank += 3;
            break;
        case 'N':
            white += 3;
            break;
        case 'n':
            blank += 3;
            break;
        case 'P':
            white += 1;
            break;
        case 'p':
            blank += 1;
            break;
        }
    }
    return white - blank;
}
int main(void)
{
    char board[8][8] = {
        [0][0] = 'K', [1][1] = 'k', [2][2] = 'q'
    };
    printf("%d\n", evaluate_position(board));
    printf("%d\n", evaluate_position2(board));
    return 0;
}